home *** CD-ROM | disk | FTP | other *** search
- package com.extensibility.xml;
-
- import com.extensibility.util.StringUtilities;
-
- public class DCDWriter$AttrProxy extends DCDWriter.DeclProxy {
- // $FF: synthetic field
- final DCDWriter this$0;
- AttributeDeclaration decl;
-
- DCDWriter$AttrProxy(DCDWriter var1) {
- super((DCDWriter)null);
- this.this$0 = var1;
- }
-
- DCDWriter$AttrProxy(DCDWriter var1, AttributeDeclaration var2) {
- super((DCDWriter)null);
- this.this$0 = var1;
- this.setDecl(var2);
- }
-
- void setDecl(AttributeDeclaration var1) {
- this.decl = var1;
- super.setDecl(var1);
- }
-
- public void write(SXE var1, boolean var2) {
- if (!this.decl.isOwnerDeclared() || this.this$0.isPreviewing()) {
- this.writeType(var1, var2);
- }
-
- }
-
- void writeDataType(SXE var1) {
- String var2;
- if (this.decl.getDataType().isEnumeration()) {
- var2 = "enumeration";
- } else {
- var2 = this.decl.getDataType().getSource().toLowerCase();
- }
-
- if (!this.decl.getDataType().equals(1)) {
- var1.writeAttr("Datatype", var2);
- }
-
- if (this.decl.getDataType().equals(2)) {
- var1.writeAttr("ID-ROLE", "ID");
- } else if (this.decl.getDataType().equals(3)) {
- var1.writeAttr("ID-ROLE", "IDREF");
- } else if (this.decl.getDataType().equals(4)) {
- var1.writeAttr("ID-ROLE", "IDREFS");
- }
-
- }
-
- void writeValues(SXE var1) {
- if (this.decl.getDataType().isEnumeration() || this.decl.getDataType().isNotation()) {
- var1.writeElem("Values", -1);
- var1.writeText(StringUtilities.concat(this.decl.getChoices(this.this$0.schema, true), "", " ", ""));
- var1.flush("Values");
- }
- }
-
- public boolean isGlobal() {
- return this.decl.isGlobal();
- }
-
- void writeGlobalType(SXE var1, boolean var2) {
- this.writeType(var1, var2, true);
- }
-
- void writeType(SXE var1, boolean var2, boolean var3) {
- var1.writeElem("AttributeDef", -1);
- var1.writeAttr("Name", this.decl.getName());
- if (var3) {
- var1.writeAttr("Global", "True");
- }
-
- this.writeDataType(var1);
- if (this.decl.getDefault() != null) {
- if (this.decl.getRequired()) {
- var1.writeAttr("Fixed", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
- } else {
- var1.writeAttr("Default", this.this$0.schema.expandPERefs(this.decl.getDefault(), this.decl));
- }
- }
-
- if (this.decl.getRequired()) {
- var1.writeAttr("Occurs", "Required");
- }
-
- this.writeValues(var1);
- if (var2) {
- ((DCDWriter.DeclProxy)this).writeComments(var1);
- }
-
- var1.flush("AttributeDef");
- }
-
- void writeType(SXE var1, boolean var2) {
- this.writeType(var1, var2, this.isGlobal());
- }
-
- void writeRef(SXE var1, boolean var2) {
- var1.writeElem("Attribute", -1);
- var1.writeText(DCDWriter.access$2000071(this.this$0, this.decl.getName()));
- var1.flush("Attribute");
- }
- }
-